#ifndef OGL_H
#define OGL_H

#if defined(__APPLE__) || defined(MACOSX)
	   #include <OpenGL/OpenGL.h>
#endif
#if defined(_WIN32)
	#include <GL/gl.h>
#endif

#include "Texture.h"
#include "Vertex.h"

namespace Y{

static void oglVertex3f( const Vertex3f& v )	{	glVertex3f( v.x(),v.y(),v.z() );			}
static void oglTexCoord2f( const Vertex2f& v )	{	glTexCoord2f( v.x(), v.y() );				}
static void oglNormal3f( const Vertex3f& v )	{	glNormal3f( v.x(),v.y(),v.z() );			}
static void oglColor4f( const Vertex4f& v )		{	glColor4f( v.r(), v.g(), v.b(), v.a() );	}
static void oglVertex_tcnv( const glVertex_tcnv& v ){ oglTexCoord2f(v.texCoord);oglColor4f(v.color);oglNormal3f(v.normal);oglVertex3f(v.coord); }

static void oglBindTexture( int t )				{	glBindTexture( GL_TEXTURE_2D,(GLuint) t ); }
static void oglBindTexture( GLuint t )			{	glBindTexture( GL_TEXTURE_2D,t );	}
static void oglBindTexture( const Texture& t )	{	glBindTexture( GL_TEXTURE_2D,t.texID );	}

static void oglAmbientColor( const Vertex4f& v )				{	GLfloat ambientLight[] = { v.r(),v.g(),v.b(),v.a() };
																	glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);			}
static void oglAmbientColor( float r,float g,float b, float a )	{	GLfloat ambientLight[] = { r,g,b,a };
																	glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);			}
																	
static void oglDiffuseColor( const Vertex4f& v )				{	GLfloat diffuseLight[] = { v.r(),v.g(),v.b(),v.a() };
																	glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);			}
static void oglDiffuseColor( float r,float g,float b, float a )	{	GLfloat diffuseLight[] = { r,g,b,a };
																	glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);			}
																	
static void oglSpecularColor( const Vertex4f& v )				{	GLfloat diffuseLight[] = { v.r(),v.g(),v.b(),v.a() };
																	glLightfv(GL_LIGHT0, GL_SPECULAR, diffuseLight);			}
static void oglSpecularColor( float r,float g,float b, float a )	{	GLfloat diffuseLight[] = { r,g,b,a };
																	glLightfv(GL_LIGHT0, GL_SPECULAR, diffuseLight);			}

}
#endif
